int mount_root_device(void)
{
	int i = 0, device = 0;
	char buf256[EXT2_MAX_FILE_LENGTH];
	char buf1024[STD_BLK_SIZE];
	SUPER super;
	
	printf("Enter path of device to mount (RETURN for /dev/fd0): ");
	scanf("%s", buf256);
	
	/* User selected default device */
	if (buf256[0] == '\0')
		strcpy(buf256, "/dev/fd0");
	
	/* Attempt to open device */
	device = open64(buf256, O_RDWR);
	if (device < 0)
	{
		printf("Could not open specified device\n\n");
		return -1;
	}
	
	/* Try to read super block */
	if (read_blk(device, 1, STD_BLK_SIZE, buf1024) == -1)
	{
		printf("There was an error reading the device super block\n\n");
		return -1;
	}
	
	/* Verify device has an Ext2/Ext3 filesystem */
	if (((SUPER*)buf1024)->s_magic != EXT2_MAGIC)
	{
		printf("The specified device does not contain a recognized Ext2/Ext3 filesystem\n\n");
		return -1;
	}
	
	/* Add the device to the mount table */
	if (add_device_to_mount_table(device, buf256, 0) == -1)
	{
		printf("Unable to add root device to mount table\n");
		return -1;
	}
	
	/* Read the device root inode */
	rootInode = get_inode(device, ROOT_INODE);
	mountTable[ROOT_DEVICE].mountedInode = get_inode(device, ROOT_INODE);
	if ((rootInode == 0) || (mountTable[ROOT_DEVICE].mountedInode == 0))
	{
		printf("There was an error while trying to read the root inode\n\n");
		return -1;
	}
	
	/* Print the type of file system the device is */
	if (((SUPER*)buf1024)->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL)
		printf("\nMounted filesystem is EXT3\n");
	else
		printf("\nMounted filesystem is EXT2\n");
		
	strcpy(mountTable[ROOT_DEVICE].mountedName, "/");
	
	rootInode->mounted = true;
	rootInode->mountedDevice = &mountTable[ROOT_DEVICE];
	
	/* Get device super block to print info */
	if (get_super(device, &super) == -1)
	{
		put_inode(rootInode);
		put_inode(mountTable[ROOT_DEVICE].mountedInode);
		return -1;
	}
	
	/* Print root device info */
	printf("\nMount: \"%s\" mounted on \"%s\"\n", mountTable[ROOT_DEVICE].diskInfo.name, mountTable[ROOT_DEVICE].mountedName);
	printf(" Num blocks: %-10d  Num inodes: %-10d\n", mountTable[ROOT_DEVICE].diskInfo.numBlocks, mountTable[0].diskInfo.numInodes);	
	printf("Free blocks: %-10d Free inodes: %-10d\n\n", super.s_free_blocks_count, super.s_free_inodes_count);
	return 1;
}
